package jiyici;

import jiyici.Constant.ItemParamType;
import android.content.Context;
import android.util.SparseArray;

import com.jiyici.R;

public class ParamType {

    public int typeName;
    public int typeIcon;
    public int typeHint;

    private ParamType(int typeName, int typeIcon, int typeHint) {
        super();
        this.typeName = typeName;
        this.typeIcon = typeIcon;
        this.typeHint = typeHint;
    }

    private static SparseArray<ParamType> types = new SparseArray<ParamType>();
    

    static {
        types.put(ItemParamType.TEXT, new ParamType(R.string.param_text, R.drawable.type_text, R.string.hint_param_text));
        types.put(ItemParamType.NUMBER, new ParamType(R.string.param_number, R.drawable.type_number, R.string.hint_param_number));
    }

    public static ParamType getParamType(int type) {
        ParamType paramType = types.get(type);
        return paramType;
    }

    public static CharSequence[] getTypeStringArray(Context context) {
        int size = ItemParamType.LAST - ItemParamType.FIRST + 1;
        int offset = ItemParamType.FIRST;
        CharSequence[] array = new CharSequence[size];
        for (int i = ItemParamType.FIRST; i <= ItemParamType.LAST; i++) {
            array[i - offset] = context.getText(types.get(i).typeName);
        }
        return array;
    }

}
